package team.se.tms.controller.select_course;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import team.se.tms.controller.BaseController;
import team.se.tms.exception.UpdateException;
import team.se.tms.service.SelectCourseInfoService;
import team.se.tms.util.ResultUtil;

import java.util.List;

/**
 * Created by argentum on 2018/12/26.
 */
@Controller
public class SelectCourseInfoController extends BaseController{

    @Autowired
    SelectCourseInfoService selectCourseInfoService;

    /**
     * 课程评分
     * @create on 2018/12/26 by argentum
     *
     * @param stuIds
     * @param scores
     * @param judgements
     * @throws Exception
     */
    @RequestMapping("gradeCourse")
    public Object gradeCourse(String teachCourseId, List<String> stuIds, List<Float> scores, List<String> judgements) throws Exception{
        Boolean success = selectCourseInfoService.modifySelectCourseGrade (teachCourseId,stuIds,scores,judgements);
        if(!success){
            throw new UpdateException();
        }
        return ResultUtil.success("评分成功");
    }
}
